package com.xiaomaoguai.socket.one;

/**
 * @Description :
 * @FileName: SocketUtils.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年6月18日 下午5:38:20
 * @Version:V1.00
 */
public class SocketUtils {

	private SocketUtils() {
	}

	private static final SocketUtils INSTANCE = new SocketUtils();

	public static SocketUtils getInstance() {
		return INSTANCE;
	}

	/*private static void initSocket() {
		ServerSocket serverSocket = null;
		try {
			serverSocket = new ServerSocket(9999);

			Socket socket = serverSocket.accept();

			SocketAddress socketAddress = socket.getRemoteSocketAddress();
			System.out.println(socketAddress.toString());

			BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));

			PrintWriter writer = new PrintWriter(socket.getOutputStream());

			while (true) {
				String msg = reader.readLine();
				System.out.println(msg);
				writer.println("Server Recevied : " + msg);
				writer.flush();
				if (msg.equals("bye")) {
					break;
				}
			}

			socket.close();

		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (serverSocket != null) {
				try {
					serverSocket.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

	}*/
}
